package com.zzb.controller;

import com.zzb.DTO.ResultDTO;
import com.zzb.VO.ProductTypeVO;
import com.zzb.service.ProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/back/product/type")
public class ProductTypeController {

    @Autowired
    private ProductTypeService productTypeService;

    @GetMapping("/all")
    public ResultDTO productTypeFindAll(ProductTypeVO productTypeVO) {
        return productTypeService.findAll(productTypeVO);
    }

    @GetMapping("/id")
    public ResultDTO productTypeFindById(ProductTypeVO productTypeVO) {
        return productTypeService.findById(productTypeVO);
    }

    @PostMapping("/add")
    public ResultDTO productAdd(ProductTypeVO productTypeVO) {
        return productTypeService.add(productTypeVO);
    }

    @PostMapping("/update")
    public ResultDTO productUpdate(ProductTypeVO productTypeVO){
        return productTypeService.update(productTypeVO);
    }

    @PostMapping("/delete")
    public ResultDTO productDelete(ProductTypeVO productTypeVO){
        return productTypeService.delete(productTypeVO);
    }
}
